{extend name="common/base"/}
<!-- 主体 -->
{block name="body"}
<form class="layui-form p-4">
	<h3 class="pb-3">微信配置</h3>
	<table class="layui-table layui-table-form">
		<tr>
			<td class="layui-td-gray">token<font>*</font>
			</td>
			<td>
				<input type="hidden" value="{$id}" name="id">
				<input type="text" name="token" lay-verify="required" autocomplete="off" placeholder="请输入Token"
					class="layui-input" {notempty name="$config.token" } value="{$config.token}" {/notempty}>
			</td>
			<td class="layui-td-gray">登录回调地址<font>*</font>
			</td>
			<td>
				<input type="text" name="login_back_url" lay-verify="required" autocomplete="off"
					placeholder="请输入微信登录回调地址" class="layui-input" {notempty name="$config.login_back_url" }
					value="{$config.login_back_url}" {/notempty}>
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">公众号appid<font>*</font>
			</td>
			<td>
				<input type="text" name="appid" lay-verify="required" autocomplete="off" placeholder="请输入appID"
					class="layui-input" {notempty name="$config.appid" } value="{$config.appid}" {/notempty}>
			</td>
			<td class="layui-td-gray">公众号appsecret<font>*</font>
			</td>
			<td>
				<input type="text" name="appsecret" lay-verify="required" autocomplete="off" placeholder="请输入secretey"
					class="layui-input" {notempty name="$config.appsecret" } value="{$config.appsecret}" {/notempty}>
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">支付商户号</td>
			<td>
				<input type="text" name="mchid" autocomplete="off" placeholder="请输入微信支付商户号" class="layui-input"
					{notempty name="$config.mchid" } value="{$config.mchid}" {/notempty}>
			</td>
			<td class="layui-td-gray">支付API密钥</td>
			<td>
				<input type="text" name="secrect_key" autocomplete="off" placeholder="请输入微信支付API密钥" class="layui-input"
					{notempty name="$config.secrect_key" } value="{$config.secrect_key}" {/notempty}>
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray">支付证书路径</td>
			<td>
				<input type="text" name="cert_url" autocomplete="off" placeholder="请输入微信支付证书路径" class="layui-input"
					{notempty name="$config.cert_url" } value="{$config.cert_url}" {/notempty}>
			</td>
			<td class="layui-td-gray">支付回调地址</td>
			<td>
				<input type="text" name="pay_back_url" autocomplete="off" placeholder="请输入微信支付回调地址" class="layui-input"
					{notempty name="$config.pay_back_url" } value="{$config.pay_back_url}" {/notempty}>
			</td>
		</tr>
		<tr>
			<td class="layui-td-gray-2">小程序appid<font>*</font>
			</td>
			<td>
				<input type="text" name="xcx_appid" lay-verify="required" autocomplete="off" placeholder="请输入小程序appid"
					class="layui-input" {notempty name="$config.xcx_appid" } value="{$config.xcx_appid}" {/notempty}>
			</td>
			<td class="layui-td-gray-3">小程序appsecret<font>*</font>
			</td>
			<td>
				<input type="text" name="xcx_appsecret" lay-verify="required" autocomplete="off"
					placeholder="请输入小程序appsecret" class="layui-input" {notempty name="$config.xcx_appsecret" }
					value="{$config.xcx_appsecret}" {/notempty}>
			</td>
		</tr>
	</table>
	<div class="py-3">
		<button class="layui-btn layui-btn-normal" lay-submit="" lay-filter="webform">立即提交</button>
		<button type="reset" class="layui-btn layui-btn-primary">重置</button>
	</div>
</form>
{/block}
<!-- /主体 -->

<!-- 脚本 -->
{block name="script"}
<script>
	const moduleInit = ['tool'];
	function gouguInit() {
		var form = layui.form, tool = layui.tool;
		//监听提交
		form.on('submit(webform)', function (data) {
			let callback = function (e) {
				layer.msg(e.msg);
				if (e.code == 0) {
					parent.layui.tool.close(1000);
				}
			}
			tool.post("/admin/conf/edit", data.field, callback);
			return false;
		});
	}
</script>
{/block}
<!-- /脚本 -->